# -!- coding: utf-8 -!-
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
# 文件：pro_msydloan_temp
获取中移动项目的临时数据：
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

from pycacho.cachobase.deal_excel import get_info,common_write
from msydwork.prod.pro_config import cursor,db

# 套餐办理成功接口数据,昨天日期
def get_user(process_no):
    sql = 'select m.hb_usr_no,bank_code from pro_main m,hb_usr u where m.process_no = "%s" and m.hb_usr_no=u.hb_usr_no;' %(process_no)
    cursor.execute(sql)
    results = cursor.fetchall()
    for result in results:
        return(result)


def get_credit(id_card):
    sql = 'select hb_usr_no,create_time from hb_usr where usr_id_card="%s";' %(id_card)
    cursor.execute(sql)
    results = cursor.fetchall()
    row = []
    for result in results:
        for data in result:
            try:
                data = data.strftime('%Y%-m%-d%')
            except:
                data = str(data)
            row.append(data)
    return(row)


def get_data():
    data = get_info('E:\zenglingwei\\file\\b.xlsx', 5, 3, 4)
    excel_data = []
    for process in data:
        row = []
        #print(process[0])
        info = get_credit(process[0])
        hb_usr = info[0]
        bank = info[1]
        row.append(hb_usr)
        row.append(bank)
        excel_data.append(row)
    print(excel_data)
    common_write(excel_data,'E:\zenglingwei\\file\\','b-copy.xlsx','sheet',0,0)


if __name__ == '__main__':
    get_data()
    #get_credit('432524198506092544')